//
//  HttpHelper.m
//  News
//
//  Created by Han on 15-4-17.
//  Copyright (c) 2015年 IPingLun. All rights reserved.
//

#import "HttpHelper.h"

static NSString * const baseURL = @"http://api.wallstreetcn.com";

@implementation HttpHelper


+ (AFHTTPSessionManager *)sharedClient {
    static AFHTTPSessionManager *_sharedClient = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
        //[config setHTTPAdditionalHeaders:@{ @"User-Agent" : @"TuneStore iOS 1.0"}];
        
        
        //设置缓存大小 其中内存缓存大小设置0M  磁盘缓存0M
        NSURLCache *cache = [[NSURLCache alloc] initWithMemoryCapacity:0
                                                          diskCapacity:0
                                                              diskPath:nil];
        [config setURLCache:cache];
        
        _sharedClient = [[AFHTTPSessionManager alloc] initWithBaseURL:[NSURL URLWithString:baseURL]
                                                 sessionConfiguration:config];
        _sharedClient.responseSerializer = [AFJSONResponseSerializer serializer];
    });
    
    return _sharedClient;
}




@end
